from django.db import models

# Create your models here.
#作者
class author(models.Model):
    name=models.CharField(max_length=50)
    email=models.CharField(max_length=50)
    bio=models.TextField()
    created_at=models.DateTimeField(auto_now_add=True)
    updated_at=models.DateTimeField(auto_now=True)

#文章
class article(models.Model):
    title=models.CharField(max_length=50)
    content=models.TextField()
    published_date = models.DateTimeField(auto_now_add=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    author_id=models.ForeignKey(author,on_delete=models.CASCADE,related_name='article')
